﻿using UnityEngine;
using System.Collections;

public class BitHandler {
	
	int ID;
	
	public BitHandler(int BaseID)
	{
		ID = BaseID;
	}
	
	public void ActivateBit(int BitIndex)
	{
		ID |= (1 << BitIndex);
	}
	
	public void DeactivateBit(int BitIndex)
	{
		ID = ID &~(1 << BitIndex);
	}
	
	public int BitIDUsed(int BitIndex)
	{
		return ID & (1 << BitIndex);
	}
	
	public void SetID(int newID)
	{
		clearID();
		ID = newID;
	}
	
	public void clearID()
	{
		ID = 0;
	}
}
